#==========================  Modules configuration ============================

metricbeat.config.modules:
  # Glob pattern for configuration loading
  path: /etc/metricbeat/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

  # Period on which files under path should be checked for changes
  reload.period: 30s

metricbeat.max_start_delay: 10s

#================================ Outputs =====================================

output.elasticsearch:
  hosts: ["ingest.elastic.service.{{ consul_dc_name }}.consul:{{ elastic_http_port }}"]
  compression_level: 5
  timeout: 300
  slow_start: true

{% if inventory_hostname == groups['all'][0] %}
#============================== Dashboards =====================================
setup.dashboards:
  enabled: true
  retry:
    enabled: true
    interval: 60s
    maximum: 10

#================================ Kibana =====================================
setup.kibana:
  host: "kibana.service.{{ consul_dc_name }}.consul"
{% endif %}

#================================ Logging =====================================
logging.to_files: true
logging.level: error
logging.files:
  rotateeverybytes: 10485760 # = 10MB
  keepfiles: 7

#================================ General =====================================
fields_under_root: true
fields:
    beat_type: metricbeat

name: {{ inventory_hostname }}

tags: [
{%- for item in group_names -%}
  "{{ item }}"{%- if loop.nextitem is defined -%},{%- endif -%}
{%- endfor -%}
]

{% if '6.3.0' is version(elk_version, operator='lt', strict=True) %}
#============================== Xpack Monitoring ===============================
xpack.monitoring:
  enabled: true
{% endif %}
